
package com.ctrip.corp.obt.shard.sql.mybatis.interceptor.dialect;


import com.ctrip.corp.obt.generic.utils.ExceptionUtils;

/**
 * SQLServer 数据库分页语句组装实现
 *
 * @author marco.zheng
 * @since 2022-03-15
 */
public class SQLServerDialect implements IDialect {

    @Override
    public PageDialectModel buildPaginationSql(String originalSql, long offset, long limit) {
        String sql = originalSql + " OFFSET " + FIRST_MARK + " ROWS FETCH NEXT " + SECOND_MARK + " ROWS ONLY";
        return new PageDialectModel(sql, offset, limit).setConsumerChain();
    }

    @Override
    public String buildTableSearchSql(String tableName) {
        throw ExceptionUtils.mpe("Do not support now");
    }
}
